<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Forum extends CI_Controller {
 	public function __construct(){
 		parent::__construct();
 		//连接数据库
 		$this->db = $this->load->database ( "default", TRUE );
 		//读取dilicms的配置属性
 		$this->siteData = $this->db->get($this->db->dbprefix('site_settings'))->row_array();
 	}
 	public function index()
 	{
 		$data["getPetCatelist"]=$this->getPetCatelist(); //将二维数组赋值给 data数组 的 info 下标变量
 		$data["getPetList"]=$this->getPetList();
 		$this->load->view('classes',$data);
 	}
 	public function getPetCatelist(){
 		$sql="select * from pet_u_c_forum where parentid=0 order by classid asc "; //构建SQL
 		$query = $this->db->query($sql); //发送sql字符串，将返回数据(byte)封装为query对象
 		$resData=$query->result_array(); //将query对象封装为二维数组
 		return $resData;
 	}
 	public function getPetList(){
 		$sql="select * from pet_u_c_forum where level!=1 and parentid!=0 order by classid asc "; //构建SQL
 		$query = $this->db->query($sql); //发送sql字符串，将返回数据(byte)封装为query对象
 		$resData=$query->result_array(); //将query对象封装为二维数组
 		return $resData;
 	}
}